<ui:composition template="/template/twocolumn-academico.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui">

    
    
       
       <ui:define name="item-menu-top">
    </ui:define>

    <ui:define name="conteudo">
     <div id="form_style">
        <h3>Alunos</h3>
        <h:form id="form">
         <p:messages id="messages" showDetail="false" autoUpdate="true" closable="true" />  
            
            <p:dataTable value="#{professorAcademicoMB.alunosDisciplinas}" var="aluno" editable="true"
            emptyMessage="nenhum registro encontrado"
             paginator="#{professorAcademicoMB.alunosDisciplinas.size() > 5}" rows="10" paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks}
           {NextPageLink} {LastPageLink} {RowsPerPageDropdown}" rowsPerPageTemplate="5,10,15" style="width: 100%" lazy="true">
                 <f:facet name="header">  
                     Alunos
                 </f:facet>  
                   <p:ajax event="rowEdit" listener="#{professorAcademicoMB.alterarNotas}" update=":form:messages" />  
                   <p:ajax event="rowEditCancel" listener="#{professorAcademicoMB.cancelarAlteracaoNotas}" update=":form:messages" />  
               
                 <p:column headerText="Disciplina">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{aluno.disciplina.nome}" />
                        </f:facet>
                        <f:facet name="input">
                            <h:inputText value="#{aluno.disciplina.nome}" size="10" readonly="true"/>
                        </f:facet>
                    </p:cellEditor>
                </p:column>
               
                <p:column headerText="matricula">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{aluno.aluno.matricula}" />
                        </f:facet>
                        <f:facet name="input">
                            <h:inputText value="#{aluno.aluno.matricula}" size="7" readonly="true" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                
                 <p:column headerText="nome">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{aluno.aluno.nome}" />
                        </f:facet>
                        <f:facet name="input">
                            <h:inputText value="#{aluno.aluno.nome}" size="15" readonly="true" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                
               <p:column headerText="1ª Nota">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{aluno.nota1}" />
                        </f:facet>
                        <f:facet name="input">
                            <h:inputText value="#{aluno.nota1}" size="5"  />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                
               <p:column headerText="2ª Nota">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{aluno.nota2}" />
                        </f:facet>
                        <f:facet name="input">
                            <h:inputText value="#{aluno.nota2}" size="5"  />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                
               <p:column headerText="média">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{aluno.media}" />
                        </f:facet>
                        <f:facet name="input">
                            <h:inputText value="#{aluno.media}" readonly="true" size="5" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                
               <p:column headerText="Situação">
                    <p:cellEditor>
                        <f:facet name="output">
                            <h:outputText value="#{aluno.statusAprovacao.valor}" />
                        </f:facet>
                        <f:facet name="input">
                            <h:inputText value="#{aluno.statusAprovacao.valor}" readonly="true" size="10" />
                        </f:facet>
                    </p:cellEditor>
                </p:column>
                
               <p:column style="width:4%">  
                    <p:rowEditor />  
                </p:column>  
            </p:dataTable>
        </h:form>
      </div>
    </ui:define>
</ui:composition>
